scripts: footprint: extend the size_report with filters #3226
      
        
          +35
        
        
          −0
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Add two new parameters to the script:
Reasoning for the first would be that without it, the script prints hundreds of lines of symbols and it's hard to keep track of what feature(s) are the most impactful on ROM/ RAM. So by setting the lowestLimit to 1, the output gets trimmed down to the essential symbols that have an impact.
Reasoning for the second would be that it gives the user the chance to select how many symbols to be printed (can be used together with lowestLimit or standalone).
When they're not set, both parameters are given the default value (0), which makes the script behave as it normally would without them. -> the user may use them if he wants or not use them/ ignore them/ be completely unaware of them and everything works as before.
Recommended usage:
Add to Kconfig:
config REPORT_LOWEST_LIMIT
int "Minimum percentage to show in the report (0-100)"
default 0
range 0 100
help
Only show symbols that use at least this percentage of total ROM.
Set to 0 to show all symbols. Leaving it on default (0), includes everything.
config REPORT_MAX_ITEMS
int "Maximum number of symbols to show in the report"
default 0
help
Only shows as many symbols as defined by this option.
Leaving it on default (0), includes everything.
Add to prj.conf or board.conf:
CONFIG_REPORT_LOWEST_LIMIT=1
CONFIG_REPORT_MAX_ITEMS=10
Signed-off-by: TudorBalus [email protected]